<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN" lang="zh-CN">
<head>
    <title>model</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Content-language" content="zh-CN" />
    <style type="text/css" media="all">
		* { padding:0;margin:0 }
		#page { height:1000px; }
		#fixed{ position:fixed;right:0;bottom:0;height:100px;width:100px;background:red; }
    </style>
</head>
<body>
<div id="page">
    <div id="fixed">text</div>
</div>
<script type="text/javascript">
//<![CDATA[
window.onload=function(){
	var fixed = document.getElementById('fixed');
	var css1compat = document.compatMode === "CSS1Compat";
	if ( !css1compat || /msie 6.0/ig.test(navigator.userAgent) ){
		var key_trans = function(key){
			return key.replace(/\-(\w)/g, function($, $1){ return $1.toUpperCase(); });
		};
		var style = {
			'get' : function(el,style){
				return el.currentStyle[key_trans(style)]=='medium' ? 0 : el.currentStyle[key_trans(style)];
			}
		};
		var timer = null;
		fixed.style.position = 'absolute';
		window.onscroll = window.onresize = document.onmousewheel = function(){
			if(timer) clearInterval(timer);
			timer = setInterval(function(){
				if(!css1compat){
					fixed.style.top = document.body.scrollTop + parseInt(document.body.clientHeight) - parseInt(style.get(fixed, 'height')) + 'px';
				}else{
					fixed.style.top = document.documentElement.scrollTop + parseInt(document.documentElement.clientHeight) - parseInt(style.get(fixed, 'height')) + 'px';
					//fixed.style.cssText = "position:absolute;top:expression((document.documentElement.scrollTop||document.body.scrollTop) + (document.documentElement.offsetHeight || document.body.clientHeight)-(this.offsetHeight)-2);";
				}
				clearInterval(timer);
			}, 100);
		};
		document.onmousewheel();
	}
}
//]]>
</script>
</body>
</html>
